package org.come.daily;

import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.swing.BorderFactory;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTree;
import javax.swing.ScrollPaneConstants;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.plaf.basic.BasicTreeUI;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreePath;

import org.come.model.EventModel;
import org.come.mouslisten.DailyMainMouseListener;
import org.come.socket.Agreement;
import org.come.socket.SendMessageUntil;
import org.come.until.CutButtonImage;
import org.come.until.SrcollPanelUI;
import org.come.until.UserMessUntil;

import com.tool.ModerateTask.TaskData;
import com.tool.btn.FormsOnOffBtn;
import com.tool.tcpimg.UIUtils;

 

/**
 * 每日活动主面板JPanel
 * 
 * @author Administrator
 * 
 */
public class JpanelDailyMain extends JPanel {
    private BtnDailyMain menuBtnEverDay, menuBtnTime, menuBtnChallenge, menuBtnWeekend, menuBtnSurprise; // 菜单按钮

    private JTree jTree; // 活动列表
    private DefaultMutableTreeNode top; // 总节点
    private JScrollPane activityScp, // 活动滚动条
            introductionScp; // 活动介绍滚动条
    private JLabel[] firstTeams, // 首杀队伍
            firstAwards; // 首杀奖励
    private BtnDailyMain receiveBtn, // 领取按钮
            shoutBtn, // 一键喊话按钮
            transBtn; // 传送地点按钮
    /**
     * 当前是哪个大类型的活动 <br>
     * 1.日常活动 <br>
     * 2.限时活动 <br>
     * 3.挑战活动 <br>
     * 4.周末活动 <br>
     * 5.意外惊喜 <br>
     */
    private int nowEventType = -1;
    /** 选中的任务 */
    private EventModel eventModel;
    /** 选中的面板 */
    private JpanelDailytask dailytask;
    /** 保存jtree中的面板 */
    private List<JpanelDailytask> dailytasksList = new ArrayList<>();

    public JpanelDailyMain() {
        setPreferredSize(new Dimension(683, 475));
        setOpaque(false);
        setLayout(null);

        // 关闭按钮事件
        FormsOnOffBtn offBtn = new FormsOnOffBtn("inkImg/old/2/1.png", 1, 90);
        offBtn.setBounds(683 - 37, 10, 25, 25);
        this.add(offBtn);

        getActivityScp();
        getFirstTeams();
        getFirstAwards();
        getTransBtn();
        getShoutBtn();
        getReceiveBtn();
        getIntroductionScp();
        getMenuBtnEverDay();
        getMenuBtnTime();
        getMenuBtnChallenge();
        getMenuBtnWeekend();
        getMenuBtnSurprise();
    }

    // /** 获取jtree的节点 */
    // public void visitAllNodes2(JTree tree) {
    // DefaultMutableTreeNode root = (DefaultMutableTreeNode)
    // tree.getModel().getRoot();// 取得tree的根节点
    // visitAllNodes(root);
    //
    // }
    //
    // /** 获取jtree的节点中的JpanelDailytask */
    // public void visitAllNodes(TreeNode node) {
    // // node is visited exactly once
    // if (node.getChildCount() >= 0) {// 判断是否有子节点
    // for (Enumeration e = node.children(); e.hasMoreElements();) {
    // DefaultMutableTreeNode n = (DefaultMutableTreeNode) e.nextElement();
    // if (n.getUserObject() instanceof JpanelDailytask) {
    // JpanelDailytask dailytask = (JpanelDailytask) n.getUserObject();
    // dailytask.setBorder(BorderFactory.createEmptyBorder());
    // }
    // visitAllNodes(n);// 若有子节点则再次查找
    // }
    // }
    // }

    /** 切换展示 */
    public void changeDailyMain(JpanelDailytask dailytask) {
        if (this.dailytask != null) {
            this.dailytask.setBorder(BorderFactory.createEmptyBorder());
        }
        this.dailytask = dailytask;
        dailytask.setBorder(BorderFactory.createLineBorder(Color.yellow));
    }

    /** 获取当前界面的任务以及活动 */
    public void getEventMap(int type) {
        if (type == -1) {
            if (nowEventType == -1) {
                type = 1;
            } else {
                return;
            }
        }
        nowEventType = type;
        // Map<Integer, EventModel> allEventModelMap =
        // UserMessUntil.getAllEventMap().getAllEventModelMap();
        List<List<EventModel>> allEventMap = getAllEventMap(type);
        top.removeAllChildren();
        int listSize = 0;
        int size = 0;

        for (int j = 0; j < allEventMap.size(); j++) {
            List<EventModel> list = allEventMap.get(j);
            DefaultMutableTreeNode taskName = new DefaultMutableTreeNode(list.get(0).getTaskName());
            top.add(taskName);
            listSize += list.size();
            for (int i = 0; i < list.size(); i++) {
                if (dailytasksList.size() < listSize) {
                    JpanelDailytask jpanelDailytask = new JpanelDailytask(list.get(i));
                    taskName.add(new DefaultMutableTreeNode(jpanelDailytask));
                    dailytasksList.add(jpanelDailytask);
                } else if (dailytasksList.size() >= listSize) {
                    dailytasksList.get(size).changeView(list.get(i));
                    taskName.add(new DefaultMutableTreeNode(dailytasksList.get(size)));
                }
                size++;
            }
        }
        DefaultTreeModel treeModel = (DefaultTreeModel) jTree.getModel();
        treeModel.reload();
    }

    /** 获取所有的活动并整理 */
    public List<List<EventModel>> getAllEventMap(int type) {
        Map<Integer, EventModel> allEventModelMap = UserMessUntil.getAllEventMap().getAllEventModelMap();
        Map<String, List<EventModel>> eventModelMap = new HashMap<>();

        for (Integer num : allEventModelMap.keySet()) {
            EventModel eventModel = allEventModelMap.get(num);

            if (type != eventModel.getTaskBigType()) {
                continue;
            }

            if (eventModelMap.get(eventModel.getTaskName()) == null) {
                ArrayList<EventModel> arrayList = new ArrayList<>();
                arrayList.add(eventModel);
                eventModelMap.put(eventModel.getTaskName(), arrayList);
            } else {
                eventModelMap.get(eventModel.getTaskName()).add(eventModel);
            }
        }
        /** 排序 */
        for (String name : eventModelMap.keySet()) {
            List<EventModel> list = eventModelMap.get(name);
            if (list.size() <= 1) {
                continue;
            }
            for (int i = 0; i < list.size() - 1; i++) {
                for (int j = i + 1; j < list.size(); j++) {
                    if (list.get(i).getgId() > list.get(j).getgId()) {
                        EventModel model = list.get(i);
                        list.set(i, list.get(j));
                        list.set(j, model);
                    }
                }
            }
        }
        List<List<EventModel>> lists = new ArrayList<>();
        for (String name : eventModelMap.keySet()) {
            List<EventModel> list = eventModelMap.get(name);
            lists.add(list);
        }
        for (int i = 0; i < lists.size() - 1; i++) {
            for (int j = i + 1; j < lists.size(); j++) {
                if (lists.get(i).get(0).getgId() > lists.get(j).get(0).getgId()) {
                    List<EventModel> model = lists.get(i);
                    lists.set(i, lists.get(j));
                    lists.set(j, model);
                }
            }
        }

        return lists;
    }

    /** 切换菜单按钮图片 */
    public void changeMenuIcon(int type) {
        try {
            menuBtnEverDay.setIcons(CutButtonImage.cuts("skin/8100226/button/B" + (type == 0 ? 220 : 219) + ".png"));
            menuBtnTime.setIcons(CutButtonImage.cuts("skin/8100226/button/B" + (type == 1 ? 224 : 223) + ".png"));
            menuBtnChallenge.setIcons(CutButtonImage.cuts("skin/8100226/button/B" + (type == 2 ? 222 : 221) + ".png"));
            menuBtnWeekend.setIcons(CutButtonImage.cuts("skin/8100226/button/B" + (type == 3 ? 228 : 227) + ".png"));
            menuBtnSurprise.setIcons(CutButtonImage.cuts("skin/8100226/button/B" + (type == 4 ? 226 : 225) + ".png"));
            getEventMap(type + 1);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    /** 清空面板 */
    public void clearView() {

    }

    /** 获取队伍首杀排行榜的 */
    public void sendRanking() {
        if (eventModel == null) {
            return;
        }
        for (int i = 0; i < firstTeams.length; i++) {
            firstTeams[i].setText("");
        }
        String sendmes = Agreement.getFiveMsgAgreement("E" + eventModel.getgId());
        SendMessageUntil.toServer(sendmes);
    }

    /** 展示当前点击的活动介绍 */
    public void getIntroduction() {
        if (eventModel == null) {
            return;
        }
        TaskData taskData = UserMessUntil.getTaskData(eventModel.getTaskId());
        if (taskData == null) {
            return;
        }
        // if (taskData.getReward() == null || taskData.getReward().equals(""))
        // {
        // for (int i = 0; i < firstAwards.length; i++) {
        // DailyMainMouseListener listener = (DailyMainMouseListener)
        // firstAwards[i].getMouseListeners()[0];
        // listener.setGoodsId(null);
        // firstAwards[i].setIcon(null);
        // }
        // } else {
        // String[] reward = taskData.getReward().split("\\|");
        // for (int i = 0; i < firstAwards.length; i++) {
        // if (reward.length >= (i + 1)) {
        // DailyMainMouseListener listener = (DailyMainMouseListener)
        // firstAwards[i].getMouseListeners()[0];
        // listener.setGoodsId(reward[i]);
        // firstAwards[i].setIcon(GoodsListFromServerUntil.imgpathAdaptive(UserMessUntil.getgoodstable(new
        // BigDecimal(reward[i])).getSkin(), 31, 30));
        // } else {
        // DailyMainMouseListener listener = (DailyMainMouseListener)
        // firstAwards[i].getMouseListeners()[0];
        // listener.setGoodsId(null);
        // firstAwards[i].setIcon(null);
        // }
        // }
        // }
        // RichLabel view = (RichLabel) introductionScp.getViewport().getView();
        // view = new RichLabel(tasktemplate.getIntroduction(),
        // UIUtils.TEXT_FONT2);
        // Dimension d = view.computeSize(283 - 14);
        // view.setSize(d);
        // view.setPreferredSize(d);
        // introductionScp.getViewport().setView(view);
    }

    private ImageIcon iconBack;

    // private ImageIcon iconLeft;
    // private ImageIcon iconRightTop;
    // private ImageIcon iconRightBottom;
    // private ImageIcon iconGift;

    @Override
    protected void paintComponent(Graphics g) {
        // TODO Auto-generated method stub
        super.paintComponent(g);
        if (iconBack == null) {
            iconBack = new ImageIcon("inkImg/old/background/S141.png");
        }
        g.drawImage(iconBack.getImage(), 0, 0, 683, 475, this);
        // if (iconLeft == null) {
        // iconLeft =
        // CutButtonImage.getImage("inkImg/hongmu/2/活动小面板1-W：398-H：347.png", 398,
        // 348);
        // }
        // g.drawImage(iconLeft.getImage(), 24, 75, iconLeft.getIconWidth(),
        // iconLeft.getIconHeight(), this);
        // if (iconRightTop == null) {
        // iconRightTop =
        // CutButtonImage.getImage("inkImg/hongmu/2/活动小面板2-W：288-H：168.png", 288,
        // 168);
        // }
        // g.drawImage(iconRightTop.getImage(), 431, 75,
        // iconRightTop.getIconWidth(), iconRightTop.getIconHeight(), this);
        // if (iconRightBottom == null) {
        // iconRightBottom =
        // CutButtonImage.getImage("inkImg/hongmu/2/活动小面板3-W：288-H：207.png", 288,
        // 207);
        // }
        // g.drawImage(iconRightBottom.getImage(), 431, 242,
        // iconRightBottom.getIconWidth(),
        // iconRightBottom.getIconHeight(), this);
        //
        // if (iconGift == null) {
        // iconGift =
        // CutButtonImage.getImage("inkImg/hongmu/2/活动-宝箱奖励-W：50-H：46.png", 50,
        // 46);
        // }
        // g.drawImage(iconGift.getImage(), 443 + 190, 220 + 131 + 15, 50, 46,
        // this);
    }

    public ImageIcon getIconBack() {
        return iconBack;
    }

    public void setIconBack(ImageIcon iconBack) {
        this.iconBack = iconBack;
    }

    public int getNowEventType() {
        return nowEventType;
    }

    public void setNowEventType(int nowEventType) {
        this.nowEventType = nowEventType;
    }

    public EventModel getEventModel() {
        return eventModel;
    }

    public void setEventModel(EventModel eventModel) {
        this.eventModel = eventModel;
    }

    public BtnDailyMain getMenuBtnEverDay() {
        if (menuBtnEverDay == null) {
            menuBtnEverDay = new BtnDailyMain("skin/8100226/button/B220.png", 1, 0, this);
            menuBtnEverDay.setBounds(57 + 0 * 102, 23, 100, 35);
            this.add(menuBtnEverDay);
        }
        return menuBtnEverDay;
    }

    public void setMenuBtnEverDay(BtnDailyMain menuBtnEverDay) {
        this.menuBtnEverDay = menuBtnEverDay;
    }

    public BtnDailyMain getMenuBtnTime() {
        if (menuBtnTime == null) {
            menuBtnTime = new BtnDailyMain("skin/8100226/button/B223.png", 1, 1, this);
            menuBtnTime.setBounds(57 + 1 * 102, 23, 100, 35);
            this.add(menuBtnTime);
        }
        return menuBtnTime;
    }

    public void setMenuBtnTime(BtnDailyMain menuBtnTime) {
        this.menuBtnTime = menuBtnTime;
    }

    public BtnDailyMain getMenuBtnChallenge() {
        if (menuBtnChallenge == null) {
            menuBtnChallenge = new BtnDailyMain("skin/8100226/button/B221.png", 1, 2, this);
            menuBtnChallenge.setBounds(57 + 2 * 102, 23, 100, 35);
            this.add(menuBtnChallenge);
        }
        return menuBtnChallenge;
    }

    public void setMenuBtnChallenge(BtnDailyMain menuBtnChallenge) {
        this.menuBtnChallenge = menuBtnChallenge;
    }

    public BtnDailyMain getMenuBtnWeekend() {
        if (menuBtnWeekend == null) {
            menuBtnWeekend = new BtnDailyMain("skin/8100226/button/B227.png", 1, 3, this);
            menuBtnWeekend.setBounds(57 + 3 * 102, 23, 100, 35);
            this.add(menuBtnWeekend);
        }
        return menuBtnWeekend;
    }

    public void setMenuBtnWeekend(BtnDailyMain menuBtnWeekend) {
        this.menuBtnWeekend = menuBtnWeekend;
    }

    public BtnDailyMain getMenuBtnSurprise() {
        if (menuBtnSurprise == null) {
            menuBtnSurprise = new BtnDailyMain("skin/8100226/button/B225.png", 1, 4, this);
            menuBtnSurprise.setBounds(57 + 4 * 102, 23, 100, 35);
            this.add(menuBtnSurprise);
        }
        return menuBtnSurprise;
    }

    public void setMenuBtnSurprise(BtnDailyMain menuBtnSurprise) {
        this.menuBtnSurprise = menuBtnSurprise;
    }

    public List<JpanelDailytask> getDailytasksList() {
        return dailytasksList;
    }

    public void setDailytasksList(List<JpanelDailytask> dailytasksList) {
        this.dailytasksList = dailytasksList;
    }

    public JpanelDailytask getDailytask() {
        return dailytask;
    }

    public void setDailytask(JpanelDailytask dailytask) {
        this.dailytask = dailytask;
    }

    public JTree getjTree() {
        if (jTree == null) {
            // 套装列表
            jTree = new JTree(getTop());
            jTree.setOpaque(false);
            jTree.putClientProperty("JTree.lineStyle", "None"); // 去除jtree的线条
            ((BasicTreeUI) jTree.getUI()).setLeftChildIndent(0); // 设置父节点与子节点左对齐，并去除缩进
            DefaultTreeCellRenderer cellRenderer = new DefaultTreeCellRenderer() {
                @Override
                public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected,
                        boolean expanded, boolean leaf, int row, boolean hasFocus) {

                    DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;
                    super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus);

                    if (node.getUserObject() instanceof JpanelDailytask) {
                        return (JpanelDailytask) node.getUserObject();
                    }
                    // 判断是几级的叶子
                    return this;
                }
            };
            cellRenderer.setLeafIcon(null); // 设置叶子图标
            try {
                cellRenderer.setOpenIcon(CutButtonImage.cuts("skin/8100226/button/B108.png")[0]);// 设置打开子节点图标
                cellRenderer.setClosedIcon(CutButtonImage.cuts("skin/8100226/button/B109.png")[0]); // 设置关闭子节点图标
            } catch (Exception e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            }

            cellRenderer.setFont(new Font("宋体", Font.PLAIN, 14));// 设置字体.
            cellRenderer.setBackgroundNonSelectionColor(new Color(0, 0, 0, 0));// 设置非选定节点的背景色
            cellRenderer.setBackgroundSelectionColor(new Color(99, 93, 90));// 设置节点在选中状态下的背景色
            cellRenderer.setBorderSelectionColor(new Color(0, 0, 0, 0));// 设置选中状态下节点边框的颜色

            /*
             * 设置选时或不选时，文字的变化颜色
             */
            cellRenderer.setTextNonSelectionColor(Color.white);// 设置绘制未选中状态下节点文本的颜色
            cellRenderer.setTextSelectionColor(Color.white);// 设置绘制选中状态下节点文本的颜色
            jTree.setCellRenderer(cellRenderer);
            jTree.setRootVisible(false); // 隐藏根节点
            // jTree.setRowHeight(60); // 设置节点行高
            // 单击展开子节点
            jTree.addMouseListener(new MouseAdapter() { // 添加鼠标事件处理
                @Override
                public void mousePressed(MouseEvent e) {
                    if (SwingUtilities.isLeftMouseButton(e)) { // 点击了鼠标左键
                        TreePath path = jTree.getSelectionPath();
                        if (path != null) {
                            if (jTree.isExpanded(path)) {
                                jTree.collapsePath(path);// 关闭节点
                            } else {
                                jTree.expandPath(path);// 展开节点
                            }
                        }

                    }
                }
            });
            jTree.addTreeSelectionListener(new TreeSelectionListener() {

                @Override
                public void valueChanged(TreeSelectionEvent e) {

                    JTree tree = (JTree) e.getSource();
                    // 利用JTree的getLastSelectedPathComponent()方法取得目前选取的节点.
                    DefaultMutableTreeNode selectionNode = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();

                    if (selectionNode == null) {
                        return;
                    }
                    String nodeName = selectionNode.toString();
                    if (selectionNode.isLeaf()) {// 判断是否是叶子节点
                        if (selectionNode.getUserObject() instanceof JpanelDailytask) {
                            // visitAllNodes2(tree);
                            JpanelDailytask dailytask = (JpanelDailytask) selectionNode.getUserObject();
                            // dailytask.setBorder(BorderFactory.createLineBorder(Color.yellow));
                            changeDailyMain(dailytask);
                            // 选中后展示首杀排行榜以及活动介绍
                            eventModel = dailytask.getEventModel();
                            getIntroduction();
                            sendRanking();
                        }
                    } else {
                    }
                }
            });
        }
        return jTree;
    }

    public void setjTree(JTree jTree) {
        this.jTree = jTree;
    }

    public DefaultMutableTreeNode getTop() {
        if (top == null) {
            top = new DefaultMutableTreeNode("");
        }
        return top;
    }

    public void setTop(DefaultMutableTreeNode top) {
        this.top = top;
    }

    public JScrollPane getActivityScp() {
        if (activityScp == null) {
            activityScp = new JScrollPane(getjTree());
            activityScp.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
            activityScp.getVerticalScrollBar().setUI(new SrcollPanelUI());
            activityScp.getVerticalScrollBar().setUnitIncrement(50);
            activityScp.getViewport().setOpaque(false);
            activityScp.setOpaque(false);
            activityScp.setBounds(49, 96, 388 + 3, 323);
            activityScp.setBorder(BorderFactory.createEmptyBorder());
            activityScp.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
            this.add(activityScp);
        }
        return activityScp;
    }

    public void setActivityScp(JScrollPane activityScp) {
        this.activityScp = activityScp;
    }

    public JLabel[] getFirstTeams() {
        if (firstTeams == null) {
            firstTeams = new JLabel[5];
            for (int i = 0; i < firstTeams.length; i++) {
                firstTeams[i] = new JLabel();
                firstTeams[i].setBounds(452 + (i + 1) % 2 * 101, 282 + (i + 1) / 2 * 24, 84, 16);
                firstTeams[i].setForeground(UIUtils.COLOR_FIRSTTEAM);
                firstTeams[i].setFont(UIUtils.TEXT_HY16);
                firstTeams[i].setHorizontalAlignment(SwingConstants.CENTER);
                this.add(firstTeams[i]);
            }
        }
        return firstTeams;
    }

    public void setFirstTeams(JLabel[] firstTeams) {
        this.firstTeams = firstTeams;
    }

    public JLabel[] getFirstAwards() {
        if (firstAwards == null) {
            firstAwards = new JLabel[5];
            for (int i = 0; i < firstAwards.length; i++) {
                firstAwards[i] = new JLabel();
                firstAwards[i].setBounds(495 + i * 30, 359, 26, 26);
                firstAwards[i].addMouseListener(new DailyMainMouseListener(null));
                this.add(firstAwards[i]);
            }
        }
        return firstAwards;
    }

    public void setFirstAwards(JLabel[] firstAwards) {
        this.firstAwards = firstAwards;
    }

    public BtnDailyMain getReceiveBtn() {
        if (receiveBtn == null) {
            receiveBtn = new BtnDailyMain("skin/8100226/newbutton/B20.png", 1, UIUtils.COLOR_WHITE2, UIUtils.TEXT_HY16, "领取",
                    11, this);
            receiveBtn.setBounds(579, 390, 59, 24);
            this.add(receiveBtn);
        }
        return receiveBtn;
    }

    public void setReceiveBtn(BtnDailyMain receiveBtn) {
        this.receiveBtn = receiveBtn;
    }

    public BtnDailyMain getShoutBtn() {
        if (shoutBtn == null) {
            shoutBtn = new BtnDailyMain("skin/8100226/newbutton/B22.png", 1, UIUtils.COLOR_WHITE2, UIUtils.TEXT_HY16, "一键喊话",
                    12, this);
            shoutBtn.setBounds(49, 426, 99, 24);
            this.add(shoutBtn);
        }
        return shoutBtn;
    }

    public void setShoutBtn(BtnDailyMain shoutBtn) {

        this.shoutBtn = shoutBtn;
    }

    public BtnDailyMain getTransBtn() {
        if (transBtn == null) {
            transBtn = new BtnDailyMain("skin/8100226/newbutton/B22.png", 1, UIUtils.COLOR_WHITE2, UIUtils.TEXT_HY16, "传送地点",
                    13, this);
            transBtn.setBounds(49 + 130, 426, 99, 24);
            this.add(transBtn);
        }
        return transBtn;
    }

    public void setTransBtn(BtnDailyMain transBtn) {
        this.transBtn = transBtn;
    }

    public JScrollPane getIntroductionScp() {
        if (introductionScp == null) {
            // 属性滚动条
            introductionScp = new JScrollPane();
            introductionScp.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
            introductionScp.getVerticalScrollBar().setUI(new SrcollPanelUI());
            introductionScp.getVerticalScrollBar().setUnitIncrement(20);
            introductionScp.getViewport().setOpaque(false);
            introductionScp.setOpaque(false);
            introductionScp.setBounds(445, 96, 215, 147);
            introductionScp.setBorder(BorderFactory.createEmptyBorder());
            introductionScp.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
            this.add(introductionScp);
        }
        return introductionScp;
    }

    public void setIntroductionScp(JScrollPane introductionScp) {
        this.introductionScp = introductionScp;
    }

}
